// 存储盘库的状态筛选和关键字搜索
import consts from "@/utils/consts";
import http from "@/utils/request";
const state = {
    inventoryState: 0,
    inventoryKeywords: '',
    moveStoreArray1:[], //移库列表
    array1:[], //重复扫码
    storeLocationInfo:{} //货架
};

const getters = {
    inventoryState: (state) => state.inventoryState || consts.allState,
    inventoryKeywords: (state) => state.inventoryKeywords,
    moveStoreArray1: (state) => state.moveStoreArray1,
}

const actions = {

}

const mutations = {
    setInventoryState: (state, status) => state.inventoryState = status,
    setInventoryKeywords: (state, keywords) => state.inventoryKeywords = keywords,
    moveStoreArray1: (state,data) => {
        if(data.flag === 1){
            state.moveStoreArray1.push(data.res) 
            // state.moveStoreArray1=[] 
        }else if(data.flag === 2){
            state.moveStoreArray1.splice(data.res,1) 
        }else if(data.flag === 3){
            state.moveStoreArray1=[] 
        }
    },
    array1:(state,data) =>{
        if(data.flag === 1){
            state.array1.push(data.code) 
            // state.array1=[]
        }else if(data.flag === 2){
            state.array1.splice(data.code,1) 
        }else if(data.flag === 3){
            state.array1=[] 
        }
    }
}

export default {
    state,
    getters,
    actions,
    mutations
}
